import Vue from 'vue'
import Vuex from 'vuex'


Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    user: null || JSON.parse(sessionStorage.getItem("user")),
    type: null || JSON.parse(sessionStorage.getItem("type"))
  },
  mutations: {

    setUser(state,val){
      state.user = val
      let userStr = JSON.stringify(val)
      sessionStorage.setItem("user",userStr)
    },
    setType(state,val){
      state.type=val
      let TypeStr=JSON.stringify(val)
      sessionStorage.setItem("type",TypeStr)
    }

  },
  actions: {

  },
  modules: {
  }
})
